package br.com.djiadreams.funcoes;

import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;

public class Local implements LocationListener {
	private double altitude, latitude, longitude;
	private float precisao;
	private String provedor;
	private LocationManager LM;

	public Local(Context c) {
		LM = (LocationManager) c.getSystemService(Context.LOCATION_SERVICE);
	}

	public void atualizaLocal() {
		if (LM.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
			LM.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
					this);
		}
	}

	public double getAltitude() {
		return altitude;
	}

	public double getLatitude() {
		return latitude;
	}

	public double getLongitude() {
		return longitude;
	}

	public float getPrecisao() {
		return precisao;
	}

	public String getProvedor() {
		return provedor;
	}

	@Override
	public void onLocationChanged(Location location) {
		// TODO Auto-generated method stub
		latitude = location.getLatitude();
		longitude = location.getLongitude();
		precisao = location.getAccuracy();
		altitude = location.getAltitude();
		provedor = location.getProvider();
	}

	@Override
	public void onProviderDisabled(String provider) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onProviderEnabled(String provider) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onStatusChanged(String provider, int status, Bundle extras) {
		// TODO Auto-generated method stub
		
	}
}